package team.qwer.demo.module1.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import team.qwer.demo.module1.entity.Test;
import team.qwer.demo.module1.service.TestService;

import java.util.List;

/**
 * @Author Administrator
 * @Date 2019/2/15 0015 22:55
 **/
@RestController
public class TestController {

    private final TestService testService;

    @Autowired
    public TestController(TestService testService) {
        this.testService = testService;
    }

    @RequestMapping("/save")
    int save(String name){
        return testService.save(name);
    }

    @RequestMapping("/query")
    public List<Test> query(){
        return testService.query();
    }

    @RequestMapping("/queryByCondition")
    public List<Test> queryByCondition(String name){
        return testService.queryByCondition(name);
    }
}
